package com.gxa.eshop.portal.thread;

import com.gxa.eshop.core.pojo.User;

public class UserThreadLocal {

    // 当前线程为了保证唯一性,通常声明为static
    private static ThreadLocal<User> userThreadLocal = new ThreadLocal<>();

    public static User get(){
        return userThreadLocal.get();
    }

    public static void set(User user){
        userThreadLocal.set(user);
    }

    public static void remove(){
        userThreadLocal.remove();
    }

}
